//
//  ShopAdvertisingViewCell.swift
//  iModern
//
//  Created by 张义帅 on 15/8/11.
//  Copyright (c) 2015年 com.starlooking. All rights reserved.
//

import UIKit

class ShopAdvertisingViewCell: TableViewCell
{

    @IBOutlet weak var shopImageView: UIImageView!

    @IBOutlet weak var shopDescribeLabel: UILabel!

    @IBOutlet weak var shopPrice: UILabel!

    @IBOutlet weak var shopInventory: UILabel!

    override func awakeFromNib()
    {
        super.awakeFromNib()
        // Initialization code
    }

    override func setSelected(selected: Bool, animated: Bool)
    {
        super.setSelected(selected, animated: animated)

        // Configure the view for the selected state
    }

    func setData(data: NSMutableDictionary)
    {
        let article  = data["article"] as! NSDictionary
        let imageURL = article["imageURL"] as? String
        self.shopImageView.load(appDelegate.parameterManager.server + "/" + imageURL!, placeholder: nil)

        let amountOfStocks: AnyObject! = article["amountOfStocks"]
        let strVar1:        String     = String(stringInterpolationSegment: amountOfStocks)
        self.shopInventory.text = "剩余:"+strVar1+"件"

        let price:   AnyObject! = article["price"]
        let strVar2: String     = String(stringInterpolationSegment: price)
        self.shopPrice.textColor = Theme.theme_color
        self.shopPrice.text = "价格:"+strVar2+"元"

        let message = article["summary"] as! String
        self.shopDescribeLabel.text = "商品名称: " + message
        shopDescribeLabel.font = UIFont.systemFontOfSize(12)
    }
}
